import { useState,useEffect } from "react";
import {FetchService} from "@/utils/request";
import Ctable from "@/components/commonTable";
import {resType} from "@/commonType";
import { Pagination } from "antd";
import type { TableProps } from 'antd';


type TablePagination<T extends object> = NonNullable<Exclude<TableProps<T>['pagination'], boolean>>;
type TablePaginationPosition<T extends object> = NonNullable<
  TablePagination<T>['position']
>[number];

const fetchService = new FetchService();


type DataType = {
  id: string;
  username: string;
  nickname: string;
  phone: string;
  email: string;
  role: string;
  status: string;
  userid:string;
}
  
const columns = [
  {
    title: '角色名',
    dataIndex: 'username',
    key: 'username',
    searchable: true,
  },
  {
    title: '菜单',
    dataIndex: 'nickname',
    key: 'nickname',
  },
  {
    title: '操作',
    dataIndex: 'op',
    key: 'op',
  }
];



const Role:React.FC = () => {
    const [tableData,setTableData] = useState<any[]>([]);
    const [page,setPage] = useState({pageNum:1,pageSize:10});
    const [total,setTotal] = useState<number>(0);
    const [bottom, setBottom] = useState<TablePaginationPosition<DataType>>('bottomRight');
    

   

    
    
    return (
        <div>
            <Ctable
                dataSource={tableData}
                columns={columns}
                role={["add","edit","delete"]}
                searchable={true}
                rowKey="userid"
                search={()=>{}}
                add={()=>{}}
            />
        </div>
    )
}

export default Role;